package com.example.ajaxdemo.controller;

import com.example.ajaxdemo.utils.NewSmsInterf;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName SendSmsController
 * @Description
 * @Author zhangsw
 * @Date 2020/12/1 9:59
 * @Version 1.0
 */
@CrossOrigin
@RestController
public class SendSmsController {

    @Resource
    NewSmsInterf smsInterf;

    @PostMapping("getSmsCode")
    public Object getSmsCode(@RequestBody Map<String,Object> param) {
        Map<String,Object> resMap = new HashMap<>();
        String code = smsInterf.sendSms(param.get("phone")+"", param.get("code")+"");
        resMap.put("statusCode", "000000");
        resMap.put("code", code);
        return resMap;
    }
}
